package com.demo.wrapper.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 19242
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Order {

    private String column;

    private boolean asc;

    public static Order KEY_ASC = new Order("_key", true);
    public static Order KEY_DESC = new Order("_key", false);
    public static Order COUNT_ASC = new Order("_count", true);
    public static Order COUNT_DESC = new Order("_count", false);

    public static Order key(boolean asc) {
        return asc ? KEY_ASC : KEY_DESC;
    }

    public static Order count(boolean asc) {
        return asc ? COUNT_ASC : COUNT_DESC;
    }

    public static Order order(String column) {
        return order(column, true);
    }

    public static Order order(String column, boolean asc) {
        return new Order(column, asc);
    }
}
